import time

from pywinauto.application import Application
#
# Application(backend="uia").start("notepad.exe")
# time.sleep(3)
# app = Application(backend="uia").connect(title_re=".*Notepad")
#
# notepad = app.window(title_re=".*Notepad")
#
# notepad.Document.type_keys("Hello World")
#
# notepad.close()

# Application(backend="uia").start("C:\\Windows\\System32\\notepad.exe")
# Application(backend="uia").start("C:\\Program Files\\Sublime Text\\sublime_text.exe")
# app = Application(backend="uia").connect(process=34008)

# app = Application(backend="uia").start("C:\\Program Files\\Sublime Text\\sublime_text.exe")
app = Application(backend="uia").connect(process=36496)
# print(app.process)

# win = app.window(title="untitled • - Sublime Text (UNREGISTERED)")
win = app.window(title_re=".*Sublime Text.*")
win.wait("exists")

# win = app.window(class_name="PX_WINDOW_CLASS")
# win = app.window(best_match="D:\\programming\\Gitwarehouse\\python\\gui_automation\\ • - Sublime Text (UNREGISTERED)Dialog")
# ['Dialog', 'D:\\programming\\Gitwarehouse\\python\\gui_automation\\ • - Sublime Text (UNREGISTERED)Dialog', 'D:\\programming\\Gitwarehouse\\python\\gui_automation\\ • - Sublime Text (UNREGISTERED)']
# win = app.window(class_name_re=".*WINDOW_CLASS")
# win.wait("visible")
# win.print_control_identifiers()
# win = app.Dialog
# win = app["Dialog"]
# win = app.untitled • - Sublime Text (UNREGISTERED)
# win = app["untitled • - Sublime Text (UNREGISTERED)"]
# win = app["untitled • - Sublime Text (UNREGISTERED)Dialog"]
# win.maximize()
# win.minimize()
# win.restore()
# print(win.get_show_state())
# print(win.is_dialog())
# print(win.is_minimized())
# print(win.is_maximized())
# print(win.is_normal())
# win = app.top_window()
